package com.cskaoyan.config;

import com.cskaoyan.bean.Animal;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author stone
 * @date 2022/11/12 09:24
 */
@Configuration
@ComponentScan("com.cskaoyan")
public class ApplicationConfiguration {

    /*@Bean
    public ProxyFactoryBean dogProxy(@Qualifier("dog") Animal dog) {
        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setTarget(dog);
        proxyFactoryBean.setInterceptorNames("helloAdvice");
        return proxyFactoryBean;
    }
    @Bean
    public ProxyFactoryBean catProxy(@Qualifier("cat") Animal cat) {
        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setTarget(cat);
        proxyFactoryBean.setInterceptorNames("helloAdvice");
        return proxyFactoryBean;
    }
    @Bean
    public ProxyFactoryBean tigerProxy(@Qualifier("tiger") Animal tiger) {
        ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
        proxyFactoryBean.setTarget(tiger);
        proxyFactoryBean.setInterceptorNames("helloAdvice");
        return proxyFactoryBean;
    }*/
}
